package com.example.leetdemo.process;

import java.util.Stack;

public class Solution2392 {

    public int[][] buildMatrix(int k, int[][] rowConditions, int[][] colConditions) {
        int[][] mat = new int[k][k];

        for (int i = 0; i < colConditions.length; i++) {
            for (int j = 0; j < colConditions[i].length; j++) {

            }
        }

        return null;
    }

    public static void main(String[] args) {
        int num = 98368;
        String str = num + "";
        int  r = 0, li = -1, ri = -1;
        for(int i = 0; i < str.length(); i++) {
            int t = (int) str.charAt(i) - '0';
            if(t >= r) {
                r = t;
                ri = i;
            }
        }
        for (int i = 0; i < str.length(); i++) {
            int t = (int) str.charAt(i) - '0';
            if (t < r) {
                li = i;
                break;
            }
        }
        if (li == -1) {
            li = ri;
        }

        StringBuilder builder = new StringBuilder();
        for(int i = 0; i < str.length(); i++) {
            if(i == li) {
                builder.append(str.charAt(ri));
            } else if(i == ri) {
                builder.append(str.charAt(li));
            } else{
                builder.append(str.charAt(i));
            }
        }
        Integer.parseInt(builder.toString());
        System.err.println(builder.toString());
    }
}
